#!/usr/bin/env python
# -*- coding: utf-8 -*-

import envs
import rospy

from darknet_ros_msgs.msg import BoundingBoxes


class Yolo():
    def __init__(self):
        rospy.Subscriber('/darknet_ros/bounding_boxes', BoundingBoxes, self.callback)
        rospy.spin()

    def callback(self, bboxes):
        self.bboxes = bboxes.bounding_boxes
        rospy.loginfo('bboxes: %s', self.bboxes)
        self.object_name = self.bboxes[0].Class
        rospy.loginfo('object name: %s', self.object_name)


if __name__ == '__main__':
    rospy.init_node('npu_robot_yolo', anonymous=True, log_level=envs.log_level)
    yolo = Yolo()
